/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.autoescola.core.entity.questionary;

import com.autoescola.core.entity.Entitie;
import com.autoescola.core.entity.security.User;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author leonardo luz fernandes
 * @version 0.1
 * @since 01/11/2010
 */

@XmlRootElement(name="UserAnswer")
@Entitie
@Entity
@Table(name="user_answer")
public class UserAnswer implements java.io.Serializable{

    private Long id;
    private UserTest userTest;
    private User user;
    private Answer answer;
    private Date answerAt;

    private boolean dout;

    private boolean aChoiceSelected;
    private boolean bChoiceSelected;
    private boolean cChoiceSelected;
    private boolean dChoiceSelected;
    private boolean eChoiceSelected;

    private boolean answerCorrect;

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name="id",nullable=false,unique=true)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }


    @Column(name="a_choice_selected",nullable=true)
    public boolean isaChoiceSelected() {
        return aChoiceSelected;
    }

    public void setaChoiceSelected(boolean aChoiceSelected) {
        this.aChoiceSelected = aChoiceSelected;
    }

    @OneToMany(targetEntity=Answer.class)
    @JoinColumn(table="answer",name="answer_id",referencedColumnName="id",nullable=false)
    public Answer getAnswer() {
        return answer;
    }

    public void setAnswer(Answer answer) {
        this.answer = answer;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name="answer_at",nullable=true)
    public Date getAnswerAt() {
        return answerAt;
    }

    public void setAnswerAt(Date answerAt) {
        this.answerAt = answerAt;
    }

    @Column(name="answer_correct")
    public boolean isAnswerCorrect() {
        return answerCorrect;
    }

    public void setAnswerCorrect(boolean answerCorrect) {
        this.answerCorrect = answerCorrect;
    }

    @Column(name="b_choice_selected",nullable=true)
    public boolean isbChoiceSelected() {
        return bChoiceSelected;
    }

    public void setbChoiceSelected(boolean bChoiceSelected) {
        this.bChoiceSelected = bChoiceSelected;
    }

    @Column(name="c_choice_selected",nullable=true)
    public boolean iscChoiceSelected() {
        return cChoiceSelected;
    }

    public void setcChoiceSelected(boolean cChoiceSelected) {
        this.cChoiceSelected = cChoiceSelected;
    }

    @Column(name="d_choice_selected",nullable=true)
    public boolean isdChoiceSelected() {
        return dChoiceSelected;
    }

    public void setdChoiceSelected(boolean dChoiceSelected) {
        this.dChoiceSelected = dChoiceSelected;
    }

    @Column(name="dout",nullable=true)
    public boolean isDout() {
        return dout;
    }

    public void setDout(boolean dout) {
        this.dout = dout;
    }

    @Column(name="e_choice_selected",nullable=true)
    public boolean iseChoiceSelected() {
        return eChoiceSelected;
    }

    public void seteChoiceSelected(boolean eChoiceSelected) {
        this.eChoiceSelected = eChoiceSelected;
    }


    @ManyToOne(targetEntity=User.class)
    @JoinColumn(name="user_id",referencedColumnName="id",nullable=false)
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @ManyToOne(targetEntity=UserTest.class)
    @JoinColumn(name="user_test_id",referencedColumnName="id",nullable=false)
    public UserTest getUserTest() {
        return userTest;
    }

    public void setUserTest(UserTest userTest) {
        this.userTest = userTest;
    }

}//end klazz
